﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Todo.Helpers
{
    public static class BindHelper
    {
        public static void BindStatus(ComboBox comboBox)
        { 
            comboBox.Items.Clear();
            comboBox.Items.Add("全部");
            comboBox.Items.Add("正常");
            comboBox.Items.Add("禁用");
            comboBox.SelectedIndex = 0;
        }

        public static void BindPageSize(ComboBox comboBox)
        {
            List<PageSize> list = new List<PageSize>()
            {
                new PageSize() { Text = "2条", Value = 2 },
                new PageSize() { Text = "10条", Value = 10 },
                new PageSize() { Text = "20条", Value = 20 },
                new PageSize() { Text = "30条", Value = 30 },
                new PageSize() { Text = "40条", Value = 40 },
                new PageSize() { Text = "50条", Value = 50 },
            };
            comboBox.DataSource = list;
            comboBox.DisplayMember = "Text";
            comboBox.ValueMember = "Value";
        }
    }

    public class PageSize
    {
        public string? Text { get; set; }
        public int Value { get; set; }
    }
}
